Skip to main content

SetColumnWidth

Sets the width of the specified column. One unit of column width is equal to the width of one character in the Normal style. For proportional fonts, the width of the character 0 (zero) is used.

Syntax

expression.SetColumnWidth(nColumn, nWidth, bWithotPaddings);

expression - A variable that represents a ApiWorksheet class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nColumnRequirednumberThe number of the column to set the width to.
nWidthRequirednumberThe width of the column divided by 7 pixels.
bWithotPaddingsOptionalbooleanfalseSpecifies whether nWidth will be set without standard paddings.

Returns

This method doesn't return any data.

Example

This example sets the width of the specified column.

var oWorksheet = Api.GetActiveSheet();
oWorksheet.SetColumnWidth(0, 10);
oWorksheet.SetColumnWidth(1, 20);